'''
Created on May 29, 2012

@author: mupet
'''

import wx

class ViewLogTab(wx.Panel):
    
    name = "View Log"
    
    def createUI(self, sizer):
        reloadButton = wx.Button(self, label='Reload')
        reloadButton.Bind(wx.EVT_BUTTON, self.listener.reloadEvent)
        sizer.Add(reloadButton, flag=wx.EXPAND, pos=(1,0))
        
        listBox = wx.ListBox(self)
        self.listener.setLogList(listBox)
        sizer.Add(listBox, flag=wx.EXPAND, pos=(0,1), span=(4,1))
        
        sizer.AddGrowableCol(1)
        sizer.AddGrowableRow(3)

    def __init__(self, parent, generalEventListener):
        '''
        Constructor
        '''
        wx.Panel.__init__(self, parent)
        self.setListener(generalEventListener)
        sizer = wx.GridBagSizer(4,4)
        self.SetSizer(sizer)
        self.createUI(sizer)
        
    def setListener(self, generalEventListener):
        self.listener = generalEventListener.getViewLogTabListener()